##############################################
# OpenWrt Makefile for h3ccloud program
##############################################
include $(TOPDIR)/rules.mk

PKG_NAME:=h3ccloud
PKG_RELEASE:=1
PKG_VERSION:=2015-08-21

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_URL:=https://git.oschina.net/linyouxiang/h3ccloud_build.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=576434a99d25ef3fe005ffea18b9c954028caea2

include $(INCLUDE_DIR)/package.mk

define Package/h3ccloud
  SECTION:=net
  CATEGORY:=Network
  TITLE:=h3ccloud -- H3C Cloud client
  DEPENDS:=+libuci +libopenssl +libjson-c +libcurl +libpthread
endef

define Package/h3ccloud/description
 H3C Cloud client
endef

define Package/h3ccloud/config
  config PACKAGE_h3ccloud_debug
    bool "Build with debug messages"
    default n
endef

define Package/h3ccloud/conffiles
/etc/config/h3ccloud
endef

define Package/h3ccloud/install
	$(INSTALL_DIR) $(1)/etc/config
	$(INSTALL_CONF) ./files/h3ccloud.config $(1)/etc/config/h3ccloud
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/h3ccloud.init $(1)/etc/init.d/h3ccloud
	$(INSTALL_DIR) $(1)/usr/sbin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/h3ccloud $(1)/usr/sbin/h3ccloud
endef

$(eval $(call BuildPackage,h3ccloud))

